package ruk.applications.copyhelper.client;

import com.google.gwt.user.client.Timer;

public class ClipboardTimer extends Timer {
    private DataListBox dataListBox;
    private int interval;

    public ClipboardTimer(DataListBox dataListBox, int interval) {
        this.dataListBox = dataListBox;
        this.interval = interval;
    }

    public void run() {
        String data = JavaScriptUtils.getClipboardData();
        if (data != null)
            dataListBox.appendData(data);
    }

    public void start() {
        scheduleRepeating(interval);
    }
}
